using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RotationPattern : MonoBehaviour
{
    //每个形状装有每个形状每个角度的位置信息
    // public Dictionary<int, List<Vector2>> patternPositionInfo = new Dictionary<int, List<Vector2>>();

    public List<Vector2> CreateFourPatternPosition(ShapeState shapeState, int index)
    {
        List<Vector2> pos = new List<Vector2>();
        switch (shapeState)
        {
            case ShapeState.L_shape:
                pos = L_Pos(index);
                break;
            case ShapeState.Z_shape:
                pos = Z_Pos(index);
                break;
            case ShapeState.T_shape:
                pos = T_Pos(index);
                break;
            case ShapeState.I_shape:
                pos = I_Pos(index);
                break;
        }

        return pos;
    }

    List<Vector2> L_Pos(int index)
    {
        List<Vector2> pos = new List<Vector2>();
        switch (index)
        {
            default:
                pos.Add(new Vector2(0, 0));
                pos.Add(new Vector2(0, 1));
                pos.Add(new Vector2(0, 2));
                pos.Add(new Vector2(1, 0));
                break;
            case 1:
                pos.Add(new Vector2(0, 0));
                pos.Add(new Vector2(1, 0));
                pos.Add(new Vector2(2, 0));
                pos.Add(new Vector2(2, 1));
                break;
            case 2:
                pos.Add(new Vector2(1, 0));
                pos.Add(new Vector2(0, 2));
                pos.Add(new Vector2(1, 1));
                pos.Add(new Vector2(1, 2));
                break;
            case 3:
                pos.Add(new Vector2(0, 0));
                pos.Add(new Vector2(0, 1));
                pos.Add(new Vector2(1, 1));
                pos.Add(new Vector2(2, 1));
                break;
        }

        return pos;
    }

    List<Vector2> Z_Pos(int index)
    {
        List<Vector2> pos = new List<Vector2>();
        switch (index)
        {
            default:
                pos.Add(new Vector2(0, 1));
                pos.Add(new Vector2(1, 0));
                pos.Add(new Vector2(2, 0));
                pos.Add(new Vector2(1, 1));
                break;
            case 1:
                pos.Add(new Vector2(0, 0));
                pos.Add(new Vector2(0, 1));
                pos.Add(new Vector2(1, 1));
                pos.Add(new Vector2(1, 2));
                break;
            case 2:
                pos.Add(new Vector2(0, 1));
                pos.Add(new Vector2(1, 0));
                pos.Add(new Vector2(2, 0));
                pos.Add(new Vector2(1, 1));
                break;
            case 3:
                pos.Add(new Vector2(0, 0));
                pos.Add(new Vector2(0, 1));
                pos.Add(new Vector2(1, 1));
                pos.Add(new Vector2(1, 2));
                break;
        }

        return pos;
    }

    List<Vector2> T_Pos(int index)
    {
        List<Vector2> pos = new List<Vector2>();
        switch (index)
        {
            default:
                pos.Add(new Vector2(0, 0));
                pos.Add(new Vector2(1, 0));
                pos.Add(new Vector2(2, 0));
                pos.Add(new Vector2(1, 1));
                break;
            case 1:
                pos.Add(new Vector2(0, 0));
                pos.Add(new Vector2(0, 1));
                pos.Add(new Vector2(0, 2));
                pos.Add(new Vector2(1, 1));
                break;
            case 2:
                pos.Add(new Vector2(0, 1));
                pos.Add(new Vector2(1, 1));
                pos.Add(new Vector2(2, 1));
                pos.Add(new Vector2(1, 0));
                break;
            case 3:
                pos.Add(new Vector2(0, 1));
                pos.Add(new Vector2(1, 0));
                pos.Add(new Vector2(1, 1));
                pos.Add(new Vector2(1, 2));
                break;
        }

        return pos;
    }

    List<Vector2> I_Pos(int index)
    {
        List<Vector2> pos = new List<Vector2>();
        switch (index)
        {
            default:
                pos.Add(new Vector2(0, 0));
                pos.Add(new Vector2(0, 1));
                pos.Add(new Vector2(0, 2));
                pos.Add(new Vector2(0, 3));
                break;
            case 1:
                pos.Add(new Vector2(1, 0));
                pos.Add(new Vector2(0, 0));
                pos.Add(new Vector2(2, 0));
                pos.Add(new Vector2(3, 0));
                break;
            case 2:
                pos.Add(new Vector2(0, 0));
                pos.Add(new Vector2(0, 1));
                pos.Add(new Vector2(0, 2));
                pos.Add(new Vector2(0, 3));
                break;
            case 3:
                pos.Add(new Vector2(1, 0));
                pos.Add(new Vector2(0, 0));
                pos.Add(new Vector2(2, 0));
                pos.Add(new Vector2(3, 0));
                break;
        }

        return pos;
    }

    /*
    void L_Pos()
    {
        //index = 0
        List<Vector2> pos0 = new List<Vector2>();
        pos0.Add(new Vector2(0, 0));
        pos0.Add(new Vector2(0, 1));
        pos0.Add(new Vector2(0, 2));
        pos0.Add(new Vector2(1, 0));
        patternPositionInfo.Add(0, pos0);
        //index = 1
        List<Vector2> pos1 = new List<Vector2>();
        pos1.Add(new Vector2(0, 0));
        pos1.Add(new Vector2(1, 0));
        pos1.Add(new Vector2(2, 0));
        pos1.Add(new Vector2(2, 1));
        patternPositionInfo.Add(1, pos1);
        //index = 2
        List<Vector2> pos2 = new List<Vector2>();
        pos2.Add(new Vector2(1, 0));
        pos2.Add(new Vector2(0, 2));
        pos2.Add(new Vector2(1, 1));
        pos2.Add(new Vector2(1, 2));
        patternPositionInfo.Add(2, pos2);
        //index = 3
        List<Vector2> pos3 = new List<Vector2>();
        pos3.Add(new Vector2(0, 0));
        pos3.Add(new Vector2(0, 1));
        pos3.Add(new Vector2(1, 1));
        pos3.Add(new Vector2(2, 1));
        patternPositionInfo.Add(3, pos3);
}
    void Z_Pos()
    {
        //index = 0
        List<Vector2> pos0 = new List<Vector2>();
        pos0.Add(new Vector2(0, 1));
        pos0.Add(new Vector2(1, 0));
        pos0.Add(new Vector2(2, 0));
        pos0.Add(new Vector2(1, 1));
        patternPositionInfo.Add(0, pos0);
        //index = 1
        List<Vector2> pos1 = new List<Vector2>();
        pos1.Add(new Vector2(0, 0));
        pos1.Add(new Vector2(0, 1));
        pos1.Add(new Vector2(1, 1));
        pos1.Add(new Vector2(1, 2));
        patternPositionInfo.Add(1, pos1);
    }

    void T_Pos()
    {
        //index = 0
        List<Vector2> pos0 = new List<Vector2>();
        pos0.Add(new Vector2(0, 0));
        pos0.Add(new Vector2(0, 1));
        pos0.Add(new Vector2(0, 2));
        pos0.Add(new Vector2(1, 1));
        patternPositionInfo.Add(0, pos0);
        //index = 1
        List<Vector2> pos1 = new List<Vector2>();
        pos1.Add(new Vector2(0, 0));
        pos1.Add(new Vector2(0, 1));
        pos1.Add(new Vector2(0, 2));
        pos1.Add(new Vector2(1, 1));
        patternPositionInfo.Add(1, pos1);
        //index = 2
        List<Vector2> pos2 = new List<Vector2>();
        pos2.Add(new Vector2(0, 1));
        pos2.Add(new Vector2(1, 1));
        pos2.Add(new Vector2(2, 1));
        pos2.Add(new Vector2(1, 0));
        patternPositionInfo.Add(2, pos2);
        //index = 3
        List<Vector2> pos3 = new List<Vector2>();
        pos3.Add(new Vector2(0, 1));
        pos3.Add(new Vector2(1, 0));
        pos3.Add(new Vector2(1, 1));
        pos3.Add(new Vector2(1, 2));
        patternPositionInfo.Add(3, pos3);
    }

    void I_Pos()
    {
        //index = 0
        List<Vector2> pos0 = new List<Vector2>();
        pos0.Add(new Vector2(0, 0));
        pos0.Add(new Vector2(0, 1));
        pos0.Add(new Vector2(0, 2));
        pos0.Add(new Vector2(0, 3));
        patternPositionInfo.Add(0, pos0);
        //index = 1
        List<Vector2> pos1 = new List<Vector2>();
        pos1.Add(new Vector2(1, 0));
        pos1.Add(new Vector2(0, 0));
        pos1.Add(new Vector2(2, 0));
        pos1.Add(new Vector2(3, 0));
        patternPositionInfo.Add(1, pos1);
    }
    */
}